<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="../plugins/layui/css/layui.css?v=${.Config.basic.version}" media="all">
    <link rel="stylesheet" href="../plugins/layui/css/style.css?v=${.Config.basic.version}" media="all">
    <link rel="stylesheet" href="../layuiadmin/style/admin.css?v=${.Config.basic.version}" media="all">
    <link rel="stylesheet" href="../plugins/zTree/css/metroStyle/metroStyle.css?v=${.Config.basic.version}">
    <link rel="stylesheet" href="../plugins/zTree/css/metroStyle/ext.css?v=${.Config.basic.version}">
    <link rel="stylesheet" href="//at.alicdn.com/t/c/font_3564966_a6tt4yhnzge.css" media="all">
    <link rel="stylesheet" href="../plugins/toastr/toastr.min.css?v=${.Config.basic.version}">
    <style>

        .layui-form-item .layui-input-inline {
            float: left;
            width: 150px;
            margin-right: 10px;
        }
        .layui-form-item {
            margin-top: 5px;
            margin-bottom: 10px;
        }

        .layui-btn + .layui-btn {
            margin-left: 5px;
        }
        .layui-btn-xs {
            height: 18px;
            line-height: 18px;
            padding: 0 5px;
            font-size: 11px;
        }

        .layui-form-label-lg {
            float: left;
            display: block;
            padding: 9px 15px;
            width: 130px;
            font-weight: 400;
            line-height: 20px;
            text-align: right;
        }

        /*.layui-form-item .layui-input[readonly] {*/
        /*    background-color: #0a1434;*/
        /*    color: #a6b8d5;*/
        /*    border: none;*/
        /*    border-top-color: currentcolor;*/
        /*    border-right-color: currentcolor;*/
        /*    border-bottom-color: currentcolor;*/
        /*    border-left-color: currentcolor;*/
        /*}*/
        .layui-form-pane .layui-form-label {
            width: 110px;
            padding: 8px 15px;
            padding-top: 8px;
            padding-right: 15px;
            padding-bottom: 8px;
            padding-left: 15px;
            height: 34px;
            line-height: 14px;
            border-width: 1px;
            border-style: solid;
            border-radius: 2px 0 0 2px;
            text-align: center;
            background-color: transparent;
            overflow: hidden;
            box-sizing: border-box;
        }
        .layui-form-label-new{
            width: 200px !important;border-color: #6c7492 !important;
        }
        .layui-colla-item {
            border-color: #3c4971;
        }
        .layui-input, .layui-select, .layui-textarea {
            border: 1px solid #6c7492;
        }
        .layui-form-pane .layui-input {
            border-radius: 0;
        }
    </style>
    <style>
        .layui-table-view .layui-table td, .layui-table-view .layui-table th {
            padding: 5px 0;
            border-top: 1px solid #404453;
            border-left: 1px solid #404453;
            border-bottom: 1px solid #404453;
            border-right: 1px solid #404453;
        }
    </style>
</head>
<body class="layui-layout-body">
    <div class="layui-fluid">
        <div class="layui-card">
            <div class="layui-card-body">
                <form class="layui-form" lay-filter="form_search" id="form_search" action="">
                    <div class="layui-form-item">


                        <div class="layui-inline">
                            <!--<label class="layui-form-label auto-size-label"></label>-->
                            <div class="layui-input-inline">
                                <input type="text" name="key" placeholder="请输入关键字" lay-verify="" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <button type="submit" class="layui-btn layui-btn-sm layui-btn-normal" lay-submit="" lay-filter="btn_search"><i class="layui-icon layui-icon-search"></i>查询</button>
                            <!--<button type="button" class="layui-btn layui-btn-normal layui-btn-sm action-export layui-hide" lay-submit="" lay-filter="btn_search"><i class="fa fa-file-excel-o"></i> 导出</button>-->
                        </div>

                    </div>
                </form>
                <div class="layui-form-item">
                    <div class="fr">
                        <button class="layui-btn layui-btn-sm layui-btn-normal  action-edit layui-hide" lay-event="add" onclick="onAdd();"><i class="layui-icon layui-icon-add-circle"></i> 新增</button>
                    </div>
                </div>

                <table class="layui-hide" id="table" lay-filter="table"></table>
                
            </div>
        </div>
    </div>


    <script src="../plugins/layui/layui.js?v=${.Config.basic.version}"></script>
    <script src="../plugins/layui/xm-select-v1.2.4.js?v=${.Config.basic.version}"></script>
    <script src="../plugins/jquery/jquery-1.10.2.js?v=${.Config.basic.version}"></script>
    <script src="../plugins/zTree/js/jquery.ztree.core.min.js?v=${.Config.basic.version}"></script>
    <script src="../plugins/zTree/js/jquery.ztree.excheck.js?v=${.Config.basic.version}"></script>
    <script src="../plugins/zTree/js/jquery.ztree.exedit.js?v=${.Config.basic.version}"></script>
    <script src="../plugins/jquery.slimscroll.min.js?v=${.Config.basic.version}"></script>
    <script src="../plugins/toastr/toastr.min.js"></script>
    <script src="../js/utils.js?v=${.Config.basic.version}"></script>
    <script src="../js/verify.js?v=${.Config.basic.version}"></script>
    <script src="../js/func.js?v=${.Config.basic.version}"></script>
    <script>
        var table=null;
        var form=null;
        var laydate = null;
        var lay_index=null;
        var Table=null;
        var transfer=null;
        var allData=[];
        var users = [];
        var selectUser = null;

        var fieldDictionary={
            "Gday":"日龄",
            "Mode":"模式",

            "CalFeed":"校准",
            "YlCheck":"余料检测",
            "EnWater":"水阀",

            "ManOut":"手动出料",
            "ManWaterOut":"手动出水",
            "FeedWater":"料水比",
            "AutoOut":"单次出料量",
            "Son":"带仔数",
            "Fit":"体况",
        };


        var time_table_para=null;
        var cruve_table_para=null;

        var token = window.localStorage.getItem("token");
        var user_info=JSON.parse(window.localStorage.getItem("user_info"));
        var func_url="${.func_url}";
        var actions=[];
        var token = window.localStorage.getItem("token");
        token = 'Bearer ' + token;
        layui.config({
            base: '../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index','layer','form', 'table','transfer','laydate'],function(){
            form = layui.form;
            table = layui.table;
            laydate = layui.laydate;
            transfer = layui.transfer;

            toastr.options = {
                "closeButton": false, //是否显示关闭按钮
                "debug": false, //是否使用debug模式
                "positionClass": "toast-top-center",//弹出窗的位置
                "showDuration": "300",//显示的动画时间
                "hideDuration": "1000",//消失的动画时间
                "timeOut": "2000", //展现时间
                "extendedTimeOut": "1000",//加长展示时间
                "showEasing": "swing",//显示时的动画缓冲方式
                "hideEasing": "linear",//消失时的动画缓冲方式
                "showMethod": "fadeIn",//显示时的动画方式
                "hideMethod": "fadeOut" //消失时的动画方式
            };

            $.ajax({
                type: 'GET',
                url: '../Api/User/Actions',
                data: {func_url:func_url},
                beforeSend: function(request) {
                    request.setRequestHeader("Authorization", 'Bearer '+window.localStorage.getItem("token"));
                },
                dataType: "json",
                success: function (data) {
                    console.info(data)
                    actions=data.data;
                    for(var i=0;i<actions.length;i++){
                        $('.action-'+actions[i].action_id).removeClass("layui-hide");
                    }
                    //initTable();
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    layer.msg('加载操作信息失败');
                }
            });

            laydate.render({
                elem: '#StartT'
                ,theme: '#133678'
                ,type: 'time'
                ,format: 'HH:mm'
                ,range: false
                ,ready: formatminutes
            });

            laydate.render({
                elem: '#EndT'
                ,theme: '#133678'
                ,type: 'time'
                ,format: 'HH:mm'
                ,range: false
                ,ready: formatminutes
            });

            $.ajax({
                type: 'GET',
                url: "../Api/User/List",
                beforeSend: function(request) {
                    request.setRequestHeader("Authorization", 'Bearer '+window.localStorage.getItem("token"));
                },
                dataType: "json",
                success: function (res) {
                    console.info(res);
                    if(res.code>=0){
                        users = res.data;
                    }else{
                        layer.alert(res.msg);
                    }
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    layer.msg('加载操作信息失败');
                }
            });

            form.on('checkbox()', function(data){
                console.log(data);
                var checked = data.elem.checked;
                console.log(data.elem.checked); //是否被选中，true或者false
                var field = $(data.elem).attr("lay-filter");
                if(field && field.length>0){
                    console.log(field);
                    console.log($(".div_"+field));
                    if(checked){
                        $(".div_"+field).show();
                        $("input[name='"+field+"']").attr("lay-verify","number");
                        //$(data.elem).attr("lay-verType","tips");
                    }else{
                        $(".div_"+field).hide();
                        $("input[name='"+field+"']").attr("lay-verify","");
                        //$(data.elem).attr("lay-verType","tips");
                    }
                }

                form.render();
            });

            //切换模式
            form.on('select(Mode)', function(data){
                console.info(data.value);
                showTableCurve(data.value);
            });

            form.on('submit(btn_ok)', function(data){
                var f = data.field; //获取提交的字段
                //console.info(data.field.enable_time_table);
                //console.info(data.field.enable_cruve_table);
                //return

                var obj={};
                if(f.enable_Gday=="on"){
                    obj["Gday"] = f.Gday;
                }
                if(f.enable_Mode=="on"){
                    obj["Mode"] = f.Mode;
                }
                if(f.enable_CalFeed=="on"){
                    obj["CalFeed"] = f.CalFeed;
                }
                if(f.enable_YlCheck=="on"){
                    obj["YlCheck"] = f.YlCheck;
                }
                if(f.enable_EnWater=="on"){
                    obj["EnWater"] = f.EnWater;
                }
                if(f.enable_ManOut=="on"){
                    obj["ManOut"] = f.ManOut;
                }
                if(f.enable_ManWaterOut=="on"){
                    obj["ManWaterOut"] = f.ManWaterOut;
                }
                if(f.enable_FeedWater=="on"){
                    obj["FeedWater"] = f.FeedWater;
                }
                if(f.enable_AutoOut=="on"){
                    obj["AutoOut"] = f.AutoOut;
                }
                if(f.enable_Son=="on"){
                    obj["Son"] = f.Son;
                }
                if(f.enable_Fit=="on"){
                    obj["Fit"] = f.Fit;
                }

                delete f.Gday;
                delete f.Mode;
                delete f.CalFeed;
                delete f.YlCheck;
                delete f.EnWater;
                delete f.ManOut;
                delete f.ManWaterOut;
                delete f.FeedWater;
                delete f.AutoOut;
                delete f.Son;
                delete f.Fit;

                delete f.enable_Gday;
                delete f.enable_Mode;
                delete f.enable_CalFeed;
                delete f.enable_YlCheck;
                delete f.enable_EnWater;
                delete f.enable_ManOut;
                delete f.enable_ManWaterOut;
                delete f.enable_FeedWater;
                delete f.enable_AutoOut;
                delete f.enable_Son;
                delete f.enable_Fit;

                console.info(time_table_para);
                console.info(cruve_table_para);

                if(f.enable_time_table){
                    //时间表有效
                    f["time_table_para"] =JSON.stringify(time_table_para);
                    delete f.enable_time_table;
                }else{
                    console.info(" enable_time_table = false");
                }
                if(f.enable_cruve_table){
                    //曲线有效
                    f["cruve_table_para"] =JSON.stringify(cruve_table_para);
                    delete f.enable_cruve_table;
                }else{
                    console.info(" enable_cruve_table = false");
                }
                f["fields"] = JSON.stringify(obj);

                //console.info(f);

                var type="";
                if(f.id.length==0){
                    type="POST";
                }else{
                    type="PUT"
                }
                $.ajax({
                    type: type,
                    url: '../Api/FeedPlan',
                    data: f,
                    beforeSend: function(request) {
                        request.setRequestHeader("Authorization", 'Bearer '+window.localStorage.getItem("token"));
                    },
                    dataType: "json",
                    success: function (res) {
                        //console.info(data)
                        if(res.code>=0){
                            toastr.success("保存成功");
                            layui.table.reload('table'); //重载表格
                            layer.close(lay_index); //再执行关闭
                        }else{
                            toastr.warning(res.msg, "异常");
                            //layer.alert('保存失败:'+data.msg);
                        }
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        layer.alert('保存失败');
                    }
                });
            });


            initTable();

            table.on('tool(table_time)', function(obj){
                var item = obj.data;
                //console.log(item)
                if(obj.event === 'edit'){
                    onEditTime(item);
                }else if(obj.event === 'reset'){
                    onResetTime(item);
                }
            });

            table.on('tool(table_curve)', function(obj){
                var item = obj.data;
                //console.log(item)
                if(obj.event === 'edit'){
                    onEditCurve(item);
                }else if(obj.event === 'reset'){
                    onResetCurve(item);
                }
            });

            //监听提交
            form.on('submit(btn_search)', function(data){
                search(data.field);
                return false;
            });
            //保存时间点
            form.on('submit(btn_time_edit_ok)', function(data){
                console.info(data.field);

                //备份之前数据
                var old_StartT = time_table_para.StartT[data.field.Idx-1];
                var old_EndT = time_table_para.EndT[data.field.Idx-1];
                var old_OutT = time_table_para.OutT[data.field.Idx-1];

                time_table_para.StartT[data.field.Idx-1] = data.field.StartT;
                time_table_para.EndT[data.field.Idx-1] = data.field.EndT;
                time_table_para.OutT[data.field.Idx-1] = data.field.OutT;
                //判断是否超过范围
                /*var sum=0;
                for(var i=0;i<6;i++){
                    sum+=parseInt(time_table_para.OutT[i]);
                }
                if(sum>100){
                    toastr.warning("出料量%之和不能超过100%", "提示");
                    time_table_para.StartT[data.field.Idx-1] = old_StartT;
                    time_table_para.EndT[data.field.Idx-1] = old_EndT;
                    time_table_para.OutT[data.field.Idx-1] = old_OutT;
                }*/
                //判断是否超过范围
                var sum=0;
                for(var i=0;i<6;i++){
                    sum+=parseInt(time_table_para.OutT[i]);
                }

                var err="";
                if(sum>100){
                    err+="出料量之和不能超过100% ";
                    time_table_para.StartT[data.field.Idx-1] = old_StartT;
                    time_table_para.EndT[data.field.Idx-1] = old_EndT;
                    time_table_para.OutT[data.field.Idx-1] = old_OutT;
                }

                var start =parseInt(data.field.StartT.replace(':',''));
                var end = parseInt(data.field.EndT.replace(':',''));
                if(end<=start){
                    err+="开始时间不能大于或等于结束时间 ";
                    time_table_para.StartT[data.field.Idx-1] = old_StartT;
                    time_table_para.EndT[data.field.Idx-1] = old_EndT;
                    time_table_para.OutT[data.field.Idx-1] = old_OutT;
                }

                if(err.length>0){
                    toastr.warning(err, "提示");
                }else{
                    layer.close(lay_index);
                }

                showTableTime();

            });
            //保存曲线点
            form.on('submit(btn_curve_edit_ok)', function(data){
                console.info(data.field.id);
                cruve_table_para.OutDay[data.field.id] = data.field.OutDay;
                cruve_table_para.OutDayType[data.field.id] = data.field.OutDayType;
                cruve_table_para.OutMax[data.field.id] = data.field.OutMax;
                var formData = form.val('form');
                if(formData.Mode){
                    showTableCurve(formData.Mode);
                }else{
                    //未选择模式，无法渲染曲线
                }
                layer.close(lay_index);
            });
            //保存分配
            form.on('submit(btn_allocate)', function(data){
                data.field.users = selectUser.getValue('valueStr');
                console.info(data.field);
                //return ;
                layer.load(1);
                $.ajax({
                    type: 'PUT',
                    url: '../Api/FeedPlan/Allocate',
                    data: data.field,
                    beforeSend: function(request) {
                        request.setRequestHeader("Authorization", 'Bearer '+window.localStorage.getItem("token"));
                    },
                    success: function(res){
                        if(res){
                            if(res.code>=0){
                                //保存成功
                                toastr.success("保存成功");
                                layui.table.reload('table'); //重载表格
                                layer.close(lay_index); //再执行关闭
                            }else{
                                //layer.alert(res.msg);
                                toastr.warning(res.msg, "异常");
                            }
                        }
                    },
                    complete: function(XMLHttpRequest, textStatus) {
                        layer.closeAll('loading');
                    },
                    dataType: "json"
                });
            });
            resize();
        });


        function initTable(){
            Table = table.render({
                elem: '#table'
                //,data:data
                ,url:'../Api/FeedPlan/Page'
                ,height: 'full-100'
                ,method:'GET'
                ,headers : {'Authorization': 'Bearer '+window.localStorage.getItem("token")}
                ,where: {}
                ,page: true
                ,limit:300
                //,toolbar: '#table_toolbar' //开启头部工具栏，并为其绑定左侧模板
                ,defaultToolbar: ['']
                ,title: ''
                ,even:true
                ,size: 'sm' //小尺寸的表格
                ,skin: 'nob' //无框风格
                ,cols: [[
                    //{type: 'checkbox', fixed: 'left'}
                    //{field:'id', title:'ID', width:120, unresize: false, sort: true}
                    {field:'name', title:'名称',width:200,  sort: true}
                    ,{field:'fields', title:'参数字段', templet: function(d) {
                            var html = "";
                            if(d.fields){
                                var f = JSON.parse(d.fields);
                                var desc_arr=[];
                                for (let key in f) {
                                    if(key=="Mode"){
                                        desc_arr.push(fieldDictionary[key]+":"+ decodeMode(f[key]));
                                    }else if(key=="FeedWater"){
                                        desc_arr.push(fieldDictionary[key]+":"+decodeFeedWater(f[key]));
                                    }else if(key=="Fit"){
                                        desc_arr.push(fieldDictionary[key]+":"+decodeFit(f[key]));
                                    }else{
                                        desc_arr.push(fieldDictionary[key]+":"+f[key]);
                                    }

                                }
                                if(desc_arr.length>0){
                                    html = desc_arr.join(",");
                                }
                            }else{
                                html="无";
                            }
                            return html;
                        }}
                    // ,{field:'food_type', title:'饲料类型',width:100, sort: true}
                    // ,{field:'food_plan', title:'饲料方案',width:100, sort: true}
                    ,{field:'type', title:'时间表',width:80, sort: false,align:'center',templet: function(d){
                            return d.time_table_para?"<i class=\"layui-icon layui-icon-note layui-text-blue \"></i>":"";
                        }}
                    ,{field:'type', title:'曲线',width:60, sort: false,align:'center',templet: function(d){
                            return d.cruve_table_para?"<i class=\"layui-icon layui-icon-note layui-text-blue \"></i>":"";
                        }}
                    ,{field:'create_user_name', title:'创建人', width:100, sort: false}
                    ,{field:'create_date', title:'创建时间',width:140,align:'center', sort: true}
                    ,{field:'update_user_name', title:'修改人',width:100, sort: false}
                    ,{field:'update_date', title:'修改时间',width:140,align:'center', sort: true}
                    ,{field:'', title:'操作', width:200,sort: false,align:'left',fixed: 'right', templet: function(d) {
                            var html = "";
                            html += "<a href='#'   class=\"layui-hide action-edit\" lay-event=\"edit\"><span class=\" layui-text-orange \">修改</span></a><span class=\"shortGreyLine layui-hide action-edit\"></span>";
                            html += "<a href='#'   class=\"layui-hide action-allocate\" lay-event=\"allocate\"><span class=\" layui-text-orange \">分配</span></a><span class=\"shortGreyLine layui-hide action-allocate\"></span>";
                            html += "<a href='#'   class=\"layui-hide action-delete\" lay-event=\"delete\"><span class=\" layui-text-orange \">删除</span></a><span class=\"shortGreyLine layui-hide action-delete\"></span>";
                            return html;
                        }}
                ]]
                ,done: function(res, curr, count){
                    for(var i=0;i<actions.length;i++){
                        $('.action-'+actions[i].action_id).removeClass("layui-hide");
                    }
                    var that = this.elem.next();
                    allData = res.data;
                    var that = this.elem.next();
                    res.data.forEach(function (item, index) {
                        //console.log(item.empName);item表示每列显示的数据
                        if (index % 2 != 0) {
                            var tr = that.find(".layui-table-box tbody tr[data-index='" + index + "']").css("background-color", "#0a1434");
                        } else {
                            var tr = that.find(".layui-table-box tbody tr[data-index='" + index + "']").css("background-color", "#00092b");
                        }
                    });
                }
            });

            table.on('sort(table)', function(obj){
                table.reload('table', {
                    initSort: obj //记录初始排序，如果不设的话，将无法标记表头的排序状态。
                    ,where: { //请求参数（注意：这里面的参数可任意定义，并非下面固定的格式）
                        //order_field: obj.field //排序字段
                        //,order_type: obj.type //排序方式
                        order:obj.field+" "+(obj.type||"")
                    }
                });
            });

            //头工具栏事件
            table.on('toolbar(table)', function(obj){
                var data = obj.data;
                switch(obj.event){
                    case 'add':
                        onAdd();
                        break;

                };
            });
            table.on('tool(table)', function(obj){
                var data = obj.data;
                switch(obj.event){
                    case 'edit':
                        onEdit(data);
                        break;

                    case 'allocate':
                        onAllocate(data);
                        break;
                    case 'delete':
                        onDelete(data);
                        break;
                };
            });
        }

        function search(params) {
            Table.reload({
                where: params
                ,page: {
                    curr: 1 //重新从第 1 页开始
                }
            });
        }

        function showTableTime(){
            if(!time_table_para){
                //重新初始化
                time_table_para={
                    StartT:[],
                    EndT:[],
                    OutT:[],
                };
                for(var i=0;i<6;i++){
                    time_table_para.StartT.push("00:00");
                    time_table_para.EndT.push("00:00");
                    time_table_para.OutT.push("0");
                }
            }

            console.info(cruve_table_para);

            var data=[];
            for(var i=0;i<6;i++){
                data.push({
                    Idx:(i+1),
                    StartT: time_table_para.StartT[i],
                    EndT: time_table_para.EndT[i],
                    OutT: time_table_para.OutT[i],
                });
            }

            table.render({
                elem: '#table_time'
                ,data:data
                //,url: "{:u('Admin/getAlarmMsgPageList')}"
                //,height: '300'
                //,method:'post'
                //,headers : {'Authorization': 'Bearer '+window.localStorage.getItem("token")}
                ,where: {}
                ,page: false
                ,limit:20
                ,title: ''
                ,even:false
                //,size: 'sm' //小尺寸的表格
                ,skin: 'nob' //无框风格
                ,cols: [[
                    //{type: 'checkbox', fixed: 'left'}
                    {field:'Idx', title:'序号', sort: false,width:70}
                    ,{field:'StartT', title:'开始时间', sort: false,width:120}
                    ,{field:'EndT', title:'结束时间', sort: false,width:120}
                    ,{field:'OutT', title:'出料量(%)', sort: false,width:120}
                    //,{field:'m_s', title:'主从',width:70, align:"center",sort: false}
                    ,{field:'', title:'操作', width:180,templet: function(d){
                            var html='';
                            //html+='<a class="edit-permission" href="#" onclick="onEditTableClick('+d.Idx+')"><span class="layui-icon layui-icon-edit layui-text-blue"> 修改</span></a>';
                            html+="<a class=\"layui-btn layui-btn-normal layui-btn-xs layui-hide action-edit\" lay-event=\"edit\">修改</a>";
                            html+="<a class=\"layui-btn layui-btn-normal layui-btn-xs layui-hide action-edit\" lay-event=\"reset\">重置</a>";
                            return html;
                        }}

                ]]
                ,done: function(res, curr, count){
                    for(var i=0;i<actions.length;i++){
                        $('.action-'+actions[i].action_id).removeClass("layui-hide");
                    }
                }
            });
        }

        function showTableCurve(mode){

            if(!cruve_table_para){
                //重新初始化
                cruve_table_para={
                    OutDay:[],
                    OutDayType:[],
                    OutMax:[],
                };

                for(var i=0;i<55;i++){
                    cruve_table_para.OutDay.push(0);
                    cruve_table_para.OutDayType.push(0);
                    cruve_table_para.OutMax.push(0);
                }
            }

            console.info(cruve_table_para)

            var data=[];
            if(mode == EMODE_IDLE){
                //停用
            }
            else if(mode == EMODE_PG){
                //妊娠
                for(var i=0;i<15;i++)
                {
                    data.push({No:(i+1),id:i,OutDay:cruve_table_para.OutDay[i],OutDayType:cruve_table_para.OutDayType[i],OutMax:cruve_table_para.OutMax[i]});
                }
            }
            else if(mode == EMODE_NP){
                //空怀
                data.push({No:1,id:15,OutDay:cruve_table_para.OutDay[15],OutDayType:cruve_table_para.OutDayType[15],OutMax:cruve_table_para.OutMax[15]});
            }
            else if(mode == EMODE_CC){
                //保育
                for(var i=0;i<10;i++)
                {
                    data.push({No:(i+1),id:i+16,OutDay:cruve_table_para.OutDay[i+16],OutDayType:cruve_table_para.OutDayType[i+16],OutMax:cruve_table_para.OutMax[i+16]});
                }
            }
            else if(mode == EMODE_FAT){
                //育肥
                for(var i=0;i<18;i++)
                {
                    data.push({No:(i+1),id:i+26,OutDay:cruve_table_para.OutDay[i+26],OutDayType:cruve_table_para.OutDayType[i+26],OutMax:cruve_table_para.OutMax[i+26]});
                }
            }
            else if(mode == EMODE_NURSE){
                //哺乳
                for(var i=0;i<10;i++)
                {
                    data.push({No:(i+1),id:i+44,OutDay:cruve_table_para.OutDay[i+44],OutDayType:cruve_table_para.OutDayType[i+44],OutMax:cruve_table_para.OutMax[i+44]});
                }
            }
            else if(mode == EMODE_BOAR){
                //公猪
                data.push({No:1,id:54,OutDay:cruve_table_para.OutDay[54],OutDayType:cruve_table_para.OutDayType[54],OutMax:cruve_table_para.OutMax[54]});
            }
            table.render({
                elem: '#table_curve'
                ,data:data
                //,url: "{:u('Admin/getAlarmMsgPageList')}"
                //,height: '300'
                //,method:'post'
                //,headers : {'Authorization': 'Bearer '+window.localStorage.getItem("token")}
                ,where: {}
                ,page: false
                ,limit:20
                ,title: ''
                ,even:false
                //,size: 'sm' //小尺寸的表格
                ,skin: 'nob' //无框风格
                ,cols: [[
                    //{type: 'checkbox', fixed: 'left'}
                    {field:'No', title:'序号', sort: false,width:70}
                    ,{field:'OutDay', title:'日龄', sort: false,width:100}
                    ,{field:'OutDayType', title:'模式', sort: false,width:100,templet: function(d){
                            var html='';
                            if(d.OutDayType>0){
                                html="线性";
                            }else{
                                html="阶梯";
                            }
                            return html;
                        }}
                    ,{field:'OutMax', title:'当天最大出料量(kg)', sort: false,width:180}

                    ,{field:'', title:'操作', width:180,templet: function(d){
                            var html='';
                            //html+='<a class="edit-permission" href="#" onclick="onEditTableClick('+d.Idx+')"><span class="layui-icon layui-icon-edit layui-text-blue"> 修改</span></a>';
                            html+="<a class=\"layui-btn layui-btn-normal layui-btn-xs layui-hide action-edit\" lay-event=\"edit\">修改</a>";
                            html+="<a class=\"layui-btn layui-btn-normal layui-btn-xs layui-hide action-edit\" lay-event=\"reset\">重置</a>";
                            return html;
                        }}

                ]]
                ,done: function(res, curr, count){
                    for(var i=0;i<actions.length;i++){
                        $('.action-'+actions[i].action_id).removeClass("layui-hide");
                    }
                }
            });
        }

        function onEditTime(item) {
            console.info(item);
            $("#form_time")[0].reset();

            form.val("form_time", item);
            layer.open({
                //area: 'auto',
                area:['400px','300px'],
                type: 1,
                shade: 0.3,
                title: '序号'+item.Idx, //不显示标题
                content: $('#form_time'), //捕获的元素，注意：最好该指定的元素要存放在body最外层，否则可能被其它的相对元素所影响
                btn: ['确定', '取消']
                ,yes: function(index, layero){
                    lay_index=index;
                    var submit = layero.find("#btn_time_edit_ok");
                    submit.click();
                }
            });
        }

        function onResetTime(item) {
            time_table_para.StartT[item.Idx-1] = "00:00";
            time_table_para.EndT[item.Idx-1] = "00:00";
            time_table_para.OutT[item.Idx-1] = 0;

            showTableTime();
        }

        function onEditCurve(item) {
            console.info(item);
            $("#form_curve")[0].reset();
            form.val("form_curve", item);
            layer.open({
                //area: 'auto',
                area:['400px','300px'],
                type: 1,
                shade: 0.3,
                title: '序号'+item.No, //不显示标题
                content: $('#form_curve'), //捕获的元素，注意：最好该指定的元素要存放在body最外层，否则可能被其它的相对元素所影响
                btn: ['确定', '取消']
                ,yes: function(index, layero){
                    lay_index=index;
                    var submit = layero.find("#btn_curve_edit_ok");
                    submit.click();
                }
            });
        }

        function onResetCurve(item) {
            console.info(item.id);
            cruve_table_para.OutDay[item.id] = 0;
            cruve_table_para.OutDayType[item.id] = 0;
            cruve_table_para.OutMax[item.id] = 0;
            var formData = form.val('form');
            if(formData.Mode){
                showTableCurve(formData.Mode);
            }else{
                //未选择模式，无法渲染曲线
            }
        }

        function onAdd() {
            for(let key  in fieldDictionary){
                $(".div_"+key).hide();
            }
            $("#form")[0].reset();
            form.render();
            layer.open({
                area:['80%','80%'],
                type: 1,
                shade: 0.5,
                shadeClose: true,
                type: 1,
                title: '新增方案', //不显示标题
                content: $('#wd_param'),
                maxmin: false,
                btn: ['确定', '取消'],
                yes: function(index, layero){
                    //点击确认触发 iframe 内容中的按钮提交
                    lay_index=index;
                    var submit = layero.contents().find("#btn_ok");
                    submit.click();
                }
            });

            var formData = form.val('form');
            if(formData.Mode){
                showTableCurve(formData.Mode);
            }else{
                //未选择模式，无法渲染曲线
            }
            showTableTime();

            resize();
        }

        function onEdit(item) {
            //console.info(item);
            for(let key  in fieldDictionary){
                $(".div_"+key).hide();
            }
            //$("#form")[0].reset();
            form.render();
            layer.open({
                area:['80%','80%'],
                type: 1,
                shade: 0.5,
                shadeClose: true,
                type: 1,
                title: '修改方案', //不显示标题
                content: $('#wd_param'),
                maxmin: false,
                btn: ['确定', '取消'],
                yes: function(index, layero){
                    //点击确认触发 iframe 内容中的按钮提交
                    lay_index=index;
                    var submit = layero.contents().find("#btn_ok");
                    submit.click();
                }
            });

            var fields=null;
            time_table_para = null;
            cruve_table_para = null;

            if(item.fields){
                fields = JSON.parse(item.fields);
                for (let key in fields) {
                    item["enable_"+key]="on";
                    item[key] = fields[key];
                    $(".div_"+key).show();
                    $("input[name='"+key+"']").attr("lay-verify","number");
                }
            }
            if(item.time_table_para){
                time_table_para = JSON.parse(item.time_table_para);
                item["enable_time_table"]="on";
            }else{
                //delete item.enable_time_table;
                item["enable_time_table"]="";
            }
            if(item.cruve_table_para){
                cruve_table_para = JSON.parse(item.cruve_table_para);
                item["enable_cruve_table"]="on";
            }else{
                //delete item.enable_cruve_table;
                item["enable_cruve_table"]="";
            }

            if(fields.Mode){
                showTableCurve(fields.Mode);
            }
            showTableTime();
            console.info(item);
            form.val('form',item);
            resize();
        }

        function onDelete(item) {
            layer.confirm('确认删除'+item.name+"?", function(index){
                //obj.del();
                layer.load(1);
                $.ajax({
                    type: 'DELETE',
                    url: '../Api/FeedPlan',
                    data: item,
                    beforeSend: function(request) {
                        request.setRequestHeader("Authorization", 'Bearer '+window.localStorage.getItem("token"));
                    },
                    dataType: "json",
                    success: function (res) {
                        //console.info(data)
                        if(res.code==0){
                            toastr.success("删除成功");
                            layui.table.reload('table'); //重载表格
                            layer.close(index); //再执行关闭
                        }else{
                            //layer.alert('失败:'+data.msg);
                            toastr.warning(res.msg, "异常");
                        }
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        layer.alert('失败');
                    },
                    complete: function(XMLHttpRequest, textStatus) {
                        layer.closeAll('loading');
                    },
                });
            });
        }

        function onAllocate(item) {
            form.val('form_allocate',{id:item.id,users:item.users});

            selectUser = xmSelect.render({
                el: '#users',
                tips: '选择操作',
                filterable: true,
                direction: 'auto',
                theme: {
                    color: '#4958b9'
                },
                prop: {
                    name: 'name',
                    value: 'userid',
                },
                data: users
            });

            var arr=[];
            if(item.users && item.users.length>0){
                arr = item.users.split(",");
            }
            selectUser.setValue(arr);

            layer.open({
                //area: 'auto',
                area:['400px','450px'],
                offset: '10%',
                shade: 0.5,
                shadeClose: true,
                type: 1,
                title: '分配用户', //不显示标题
                content: $('#form_allocate'), //捕获的元素，注意：最好该指定的元素要存放在body最外层，否则可能被其它的相对元素所影响
                maxmin: false,
                btn: ['确定', '取消'],
                yes: function(index, layero){
                    //点击确认触发 iframe 内容中的按钮提交
                    lay_index=index;
                    var submit = layero.contents().find("#btn_allocate");
                    submit.click();
                }
            });
        }

        function deepCopy(obj) {
            if (typeof obj != 'object') {
                return obj;
            }
            var newobj = {};
            for (var attr in obj) {
                newobj[attr] = deepCopy(obj[attr]);
            }
            return newobj;
        }

        $(window).resize(function () {
            //console.info('resize')
            resize();
        });
        function resize() {
            var h = $('#wd_param').height();
            console.info(h)
            $(".content-scroll").slimScroll({
                height: h-70-60-50,
                size: '4px', //组件宽度
                color: '#eee', //滚动条颜色
                position: 'right', //组件位置：left/right
                distance: '0px', //组件与侧边之间的距离
                start: 'top', //默认滚动位置：top/bottom
                opacity: .4, //滚动条透明度
                alwaysVisible: true, //是否 始终显示组件
                disableFadeOut: false, //是否 鼠标经过可滚动区域时显示组件，离开时隐藏组件
                railVisible: true, //是否 显示轨道
                railColor: '#333', //轨道颜色
                railOpacity: .2, //轨道透明度
                railDraggable: true, //是否 滚动条可拖动
                railClass: 'slimScrollRail', //轨道div类名
                barClass: 'slimScrollBar', //滚动条div类名
                wrapperClass: 'slimScrollDiv', //外包div类名
                allowPageScroll: true, //是否 使用滚轮到达顶端/底端时，滚动窗口
                wheelStep: 10, //滚轮滚动量
                touchScrollStep: 200, //滚动量当用户使用手势
                borderRadius: '7px', //滚动条圆角
                railBorderRadius: '7px' //轨道圆角
            });
        }
        function formatminutes(date){
            $($(".laydate-time-list li ol")[2]).find("li").remove(); //清空秒
        }
    </script>



    <div  id="wd_param" style="display:none;height: 95%;">
        <form  class="layui-form layui-form-pane" id="form" lay-filter="form">

            <input class="layui-hide" type="text" placeholder="" name="id" lay-verify="" lay-verType="tips" autocomplete="off" class="layui-input">

            <div class="layui-form-item" style="padding: 5px 10px;">
                <div class="layui-inline">
                    <label class="layui-form-label layui-form-label-new">方案名称</label>
                    <div class="layui-input-inline">
                        <input type="text" placeholder="" name="name" lay-verify="required" lay-verType="tips" autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>

            <div class="layui-form-item" style="padding: 5px 10px;">
                <div class="layui-inline">
                    <label class="layui-form-label layui-form-label-new">饲料类型</label>
                    <div class="layui-input-inline">
                        <select  name="food_type" lay-filter="food_type" lay-verify="" lay-search=""  >
                            <option value=""></option>
                            <option value="粉料">粉料</option>
                            <option value="颗粒料">颗粒料</option>
                        </select>
                    </div>
                </div>

                <div class="layui-inline">
                    <label class="layui-form-label layui-form-label-new">饲料方案</label>
                    <div class="layui-input-inline">
                        <select  name="food_plan" lay-filter="food_plan" lay-verify="" lay-search=""  >
                            <option value=""></option>
                            <option value="空怀饲料">空怀饲料</option>
                            <option value="妊娠饲料">妊娠饲料</option>
                            <option value="哺乳饲料">哺乳饲料</option>
                            <option value="教槽料">教槽料</option>
                            <option value="保育料">保育料</option>
                            <option value="育肥料">育肥料</option>
                            <option value="公猪料">公猪料</option>
                        </select>
                    </div>
                </div>
            </div>

            <div class="layui-tab layui-tab-brief" >
                <ul class="layui-tab-title">
                    <li class="layui-this">基本参数</li>
                    <li>时间表</li>
                    <li>曲线</li>
                </ul>
                <div class="layui-tab-content">
                    <div class="layui-tab-item layui-show">
                        <div class="content-scroll">
                            <div class="layui-form-item">
                                <!--<i class="layui-icon layui-icon-about layui-text-gray layui-text-sm" lay-tips="勾选需要设置的参数"></i>-->
                                <input type="checkbox" lay-filter="Gday" name="enable_Gday" title="日龄">
                                <input type="checkbox" lay-filter="Mode" name="enable_Mode" title="模式">
                                <input type="checkbox" lay-filter="CalFeed" name="enable_CalFeed" title="校准">
                                <input type="checkbox" lay-filter="YlCheck" name="enable_YlCheck" title="余料检测">
                                <input type="checkbox" lay-filter="EnWater" name="enable_EnWater" title="水阀">
                                <input type="checkbox" lay-filter="ManOut" name="enable_ManOut" title="手动出料">
                                <input type="checkbox" lay-filter="ManWaterOut" name="enable_ManWaterOut" title="手动出水">
                                <input type="checkbox" lay-filter="FeedWater" name="enable_FeedWater" title="料水比">
                                <input type="checkbox" lay-filter="AutoOut" name="enable_AutoOut" title="单次出料量">
                                <input type="checkbox" lay-filter="Son" name="enable_Son" title="带仔数">
                                <input type="checkbox" lay-filter="Fit" name="enable_Fit" title="体况">
                            </div>

                            <div class="layui-form-item div_Gday" style="display: none;">
                                <div class="layui-inline">
                                    <label class="layui-form-label layui-form-label-new">日龄</label>
                                    <div class="layui-input-inline">
                                        <input type="text" placeholder="" name="Gday" lay-verify="" lay-verType="tips" autocomplete="off" class="layui-input">
                                    </div>

                                </div>
                            </div>

                            <div class="layui-form-item div_Mode" style="display: none;">
                                <div class="layui-inline">
                                    <label class="layui-form-label layui-form-label-new">模式</label>
                                    <div class="layui-input-inline">
                                        <select  name="Mode" lay-filter="Mode" lay-verify="required" lay-search=""  >
                                            <option value="0">停用</option>
                                            <option value="1">妊娠</option>
                                            <option value="2">空怀</option>
                                            <option value="3">保育</option>
                                            <option value="4">育肥</option>
                                            <option value="5">哺乳</option>
                                            <option value="6">公猪</option>
                                        </select>
                                    </div>
                                </div>
                            </div>

                            <div class="layui-form-item div_CalFeed" style="display: none;">
                                <div class="layui-inline">
                                    <label class="layui-form-label layui-form-label-new">10圈出料数(g)</label>
                                    <div class="layui-input-inline">
                                        <input type="text" placeholder="" name="CalFeed" lay-verify="" lay-verType="tips" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                            </div>

                            <div class="layui-form-item div_YlCheck" style="display: none;">
                                <div class="layui-inline">
                                    <label class="layui-form-label layui-form-label-new">余料检测</label>
                                    <div class="layui-input-inline">
                                        <select  name="YlCheck" lay-filter="YlCheck" lay-verify="" lay-search=""  >
                                            <option value="0">关闭</option>
                                            <option value="1">开启</option>
                                        </select>
                                    </div>
                                </div>
                            </div>

                            <div class="layui-form-item div_EnWater" style="display: none;">
                                <div class="layui-inline">
                                    <label class="layui-form-label layui-form-label-new">水阀</label>
                                    <div class="layui-input-inline">
                                        <select  name="EnWater" lay-filter="EnWater" lay-verify="" lay-search=""  >
                                            <option value="0">关闭</option>
                                            <option value="1">开启</option>
                                        </select>
                                    </div>
                                </div>
                            </div>

                            <div class="layui-form-item div_ManOut" style="display: none;">
                                <div class="layui-inline">
                                    <label class="layui-form-label layui-form-label-new">手动出料(g)</label>
                                    <div class="layui-input-inline">
                                        <input type="text" placeholder="" name="ManOut" lay-verify="" lay-verType="tips" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                            </div>

                            <div class="layui-form-item div_ManWaterOut" style="display: none;">
                                <div class="layui-inline">
                                    <label class="layui-form-label layui-form-label-new">手动出水(ml)</label>
                                    <div class="layui-input-inline">
                                        <input type="text" placeholder="" name="ManWaterOut" lay-verify="" lay-verType="tips" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                            </div>

                            <div class="layui-form-item div_FeedWater" style="display: none;">
                                <div class="layui-inline">
                                    <label class="layui-form-label layui-form-label-new">料水比</label>
                                    <div class="layui-input-inline">
                                        <select  name="FeedWater" lay-filter="FeedWater" lay-verify="" lay-search=""  >
                                            <option value="0">不出水</option>
                                            <option value="1">1:1</option>
                                            <option value="2">1:2</option>
                                            <option value="3">1:3</option>
                                            <option value="4">1:4</option>
                                            <option value="5">1:5</option>
                                        </select>
                                    </div>
                                </div>
                            </div>

                            <div class="layui-form-item div_AutoOut" style="display: none;">
                                <div class="layui-inline">
                                    <label class="layui-form-label layui-form-label-new">单次出料量(g)</label>
                                    <div class="layui-input-inline">
                                        <input type="text" placeholder="" name="AutoOut" lay-verify="" lay-verType="tips" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                            </div>

                            <div class="layui-form-item div_Son" style="display: none;">
                                <div class="layui-inline">
                                    <label class="layui-form-label layui-form-label-new">带仔数</label>
                                    <div class="layui-input-inline">
                                        <input type="text" placeholder="0-20" name="Son" lay-verify="" lay-verType="tips" autocomplete="off" class="layui-input">
                                    </div>
                                </div>
                            </div>

                            <div class="layui-form-item div_Fit" style="display: none;">
                                <div class="layui-inline">
                                    <label class="layui-form-label layui-form-label-new">体况</label>
                                    <div class="layui-input-inline">
                                        <select  name="Fit" lay-filter="Fit" lay-verify="" lay-verType="tips" lay-search=""  >
                                            <option value="0">较瘦</option>
                                            <option value="1">偏瘦</option>
                                            <option value="2">正常</option>
                                            <option value="3">偏胖</option>
                                            <option value="4">较胖</option>
                                        </select>
                                    </div>
                                </div>
                            </div>

                        </div>
                    </div>
                    <div class="layui-tab-item ">
                        <div class="content-scroll">
                            <!--<blockquote class="layui-elem-quote"> 时间表</blockquote>-->
                            <input type="checkbox"  name="enable_time_table" lay-skin="switch" lay-filter="enable_time_table" lay-text="有效|无效">
                            <table class="layui-hide" id="table_time" lay-filter="table_time"></table>
                        </div>
                    </div>
                    <div class="layui-tab-item ">
                        <div class="content-scroll">
                            <!--<blockquote class="layui-elem-quote"> 曲线表</blockquote>-->
                            <input type="checkbox"  name="enable_cruve_table" lay-skin="switch" lay-filter="enable_cruve_table" lay-text="有效|无效">
                            <div class="layui-form-mid layui-word-aux layui-text-orange layui-text-xs fr"><i class="layui-icon layui-icon-about"></i> 注意:曲线设置必须跟饲喂模式联动，设置前请选择饲喂模式</div>

                            <div class="layui-form-item">

                            </div>

                            <table class="layui-hide" id="table_curve" lay-filter="table_curve"></table>
                        </div>
                    </div>
                </div>
            </div>

            <div class="layui-form-item layui-hide">
                <input type="button" lay-submit lay-filter="btn_ok" id="btn_ok" value="保存">
                <input type="button" lay-submit lay-filter="btn_cancel" id="btn_cancel" value="取消">
            </div>
        </form>
    </div>

    <form class="layui-form" lay-filter="form_time" id="form_time" style="padding: 20px 30px 0 0;display:none;">
        <div class="layui-form-item layui-hide">
            <label class="layui-form-label"></label>
            <div class="layui-input-block">
                <input type="text" name="Idx" lay-verify="required" placeholder="" autocomplete="off" class="layui-input" style="width: 100%">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">起始时间</label>
            <div class="layui-input-block">
                <input type="text" name="StartT" id="StartT" lay-verify="required" lay-verType="tips" placeholder="起始时间" autocomplete="off" class="layui-input" style="width: 100%;">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">结束时间</label>
            <div class="layui-input-block">
                <input type="text" name="EndT" id="EndT" lay-verify="required" lay-verType="tips" placeholder="结束时间" autocomplete="off" class="layui-input" style="width: 100%;">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">出料量(%)</label>
            <div class="layui-input-block">
                <input  type="text" name="OutT" lay-verify="percent" lay-verType="tips" placeholder="%" autocomplete="off" class="layui-input" style="width: 100%;">
            </div>
        </div>

        <div class="layui-form-item layui-hide">
            <input type="button" lay-submit lay-filter="btn_time_edit_ok" id="btn_time_edit_ok" value="确认">
            <input type="button" lay-submit lay-filter="btn_cancel" id="btn_cancel" value="取消">
        </div>

    </form>

    <form class="layui-form" lay-filter="form_curve" id="form_curve" style="padding: 20px 30px 0 0;display:none;">
        <div class="layui-form-item layui-hide">
            <label class="layui-form-label"></label>
            <div class="layui-input-block">
                <input type="text" name="id" lay-verify="required" placeholder="" autocomplete="off" class="layui-input" style="width: 100%">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">模式</label>
            <div class="layui-input-block">
                <select  name="OutDayType" lay-filter="OutDayType" lay-verify="required" lay-search="" style="width: 100%;" >
                    <option value="0">阶梯</option>
                    <option value="1">线性</option>
                </select>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">日龄</label>
            <div class="layui-input-block">
                <input type="text" name="OutDay" id="OutDay" lay-verify="number" lay-verType="tips" placeholder="起始时间" autocomplete="off" class="layui-input" style="width: 100%;">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">出料量(kg)</label>
            <div class="layui-input-block">
                <input type="text" name="OutMax" id="OutMax" lay-verify="number" lay-verType="tips" placeholder="结束时间" autocomplete="off" class="layui-input" style="width: 100%;">
            </div>
        </div>


        <div class="layui-form-item layui-hide">
            <input type="button" lay-submit lay-filter="btn_curve_edit_ok" id="btn_curve_edit_ok" value="确认">
            <input type="button" lay-submit lay-filter="btn_cancel" id="btn_cancel" value="取消">
        </div>

    </form>

    <form class="layui-form" lay-filter="form_allocate" id="form_allocate" style="padding: 20px 30px 0 0;display:none;">
        <input class="layui-hide" type="text" name="id" lay-verify="">

        <div class="layui-form-item">
            <label class="layui-form-label">分配用户</label>
            <div class="layui-input-inline" style="width: 200px;">
                <div id="users" class="demo-transfer"></div>
            </div>
        </div>
        <div class="layui-form-item layui-hide">
            <input type="button" lay-submit lay-filter="btn_allocate" id="btn_allocate" value="确认">
            <input type="button" lay-submit lay-filter="btn_cancel" id="btn_cancel" value="取消">
        </div>
    </form>
<script src="../js/check_screen.js?v=${.Config.basic.version}"></script>

</body>
</html>